<template>
  <div class="not-found-view">
    <div class="not-found-container">
      <div class="error-illustration">
        <div class="error-code">404</div>
        <div class="error-icon">🔍</div>
      </div>
      
      <div class="error-content">
        <h1>页面不存在</h1>
        <p>抱歉，你访问的页面不存在或已被删除</p>
        
        <div class="error-actions">
          <el-button type="primary" size="large" @click="goHome">
            返回首页
          </el-button>
          <el-button size="large" @click="goBack">
            返回上页
          </el-button>
        </div>
      </div>
      
      <!-- 推荐链接 -->
      <div class="suggestions">
        <h3>你可能想要：</h3>
        <div class="suggestion-links">
          <router-link to="/" class="suggestion-item">
            <el-icon><House /></el-icon>
            <span>浏览商品</span>
          </router-link>
          <router-link to="/publish" class="suggestion-item">
            <el-icon><Plus /></el-icon>
            <span>发布商品</span>
          </router-link>
          <router-link to="/collects" class="suggestion-item">
            <el-icon><Star /></el-icon>
            <span>我的收藏</span>
          </router-link>
          <router-link to="/profile" class="suggestion-item">
            <el-icon><User /></el-icon>
            <span>个人中心</span>
          </router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { 
  House, 
  Plus, 
  Star, 
  User 
} from '@element-plus/icons-vue'

const router = useRouter()

// 返回首页
const goHome = () => {
  router.push('/')
}

// 返回上一页
const goBack = () => {
  router.go(-1)
}
</script>

<style scoped>
.not-found-view {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.not-found-container {
  text-align: center;
  max-width: 600px;
  width: 100%;
}

.error-illustration {
  position: relative;
  margin-bottom: 40px;
}

.error-code {
  font-size: 120px;
  font-weight: 900;
  color: #e8e8e8;
  line-height: 1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-icon {
  font-size: 48px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
  50% { transform: translate(-50%, -50%) translateY(-10px); }
}

.error-content h1 {
  font-size: 32px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
}

.error-content p {
  font-size: 16px;
  color: #666;
  margin-bottom: 30px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
}

.suggestions {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.suggestions h3 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

.suggestion-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
}

.suggestion-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 15px;
  background: #f8f9fa;
  border-radius: 8px;
  text-decoration: none;
  color: #666;
  transition: all 0.3s ease;
}

.suggestion-item:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateY(-2px);
}

.suggestion-item .el-icon {
  font-size: 24px;
}

.suggestion-item span {
  font-size: 14px;
  font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .error-code {
    font-size: 80px;
  }
  
  .error-icon {
    font-size: 32px;
  }
  
  .error-content h1 {
    font-size: 24px;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .suggestion-links {
    grid-template-columns: repeat(2, 1fr);
  }
}
</style>